home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gshtx.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.9 KB  |  153 lines

  1. /* Copyright (C) 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gshtx.h,v 1.2 2000/09/19 19:00:29 lpd Exp $ */
  20. /* High-level interface to stand-alone halftone/transfer objects */
  21.  
  22. #ifndef gshtx_INCLUDED
  23. #  define gshtx_INCLUDED
  24.  
  25. #include "gsmemory.h"
  26. #include "gscsepnm.h"
  27. #include "gsht1.h"
  28. #include "gxtmap.h"
  29.  
  30. /*
  31.  * The stand-alone halftone structures are opaque, and are placed in an opaque
  32.  * graphic state. 
  33.  */
  34.  
  35. /* Alias type names */
  36. #define gs_ht gs_halftone
  37. #define gs_spot_ht gs_spot_halftone
  38. #define gs_threshold_ht gs_threshold_halftone
  39. #define gs_ht_component gs_halftone_component
  40. #define gs_multiple_ht gs_multiple_halftone
  41. /* Alias GC descriptors */
  42. #define st_gs_ht st_halftone
  43. #define st_ht_comp_element st_ht_component_element
  44. /* Alias member names */
  45. #define ht_spot spot
  46. #define ht_threshold threshold
  47. #define ht_multiple multiple
  48.  
  49. #ifndef gs_state_DEFINED
  50. #  define gs_state_DEFINED
  51. typedef struct gs_state_s gs_state;
  52.  
  53. #endif
  54.  
  55. /*
  56.  * A "closure" form of gs_mapping_proc. This allows the procedure to access
  57.  * client data for the purpose of filling in the transfer information.
  58.  *
  59.  * As with PostScript transfer functions, the operand will be in the range
  60.  * [0, 1], and the result should be in the same range.
  61.  */
  62. typedef gs_mapping_closure_proc_t gs_ht_transfer_proc;    /* see gxtmap.h */
  63.  
  64. /*
  65.  * Constructor, destructor, assign, and copy routines for a gs_ht
  66.  * structure, and to install them in the graphic state.
  67.  *
  68.  * Notes:
  69.  *
  70.  *    Construction of a gs_ht halftone requires two steps: creating the
  71.  *    overall halftone, and creating each of the components. Client data
  72.  *    must be provided for each of the latter steps.
  73.  *
  74.  *    The type field of gs_ht halftones will always be ht_type_multiple;
  75.  *    if only one component is required, this halftone will always be given
  76.  *    the component name "Default".
  77.  *
  78.  *    The type fields of the gs_ht_component structures pointed to by the
  79.  *    gs_multiple_ht structure will have the value ht_type_spot or
  80.  *    ht_type_threshold; the constructor routines will not build any
  81.  *    other types.
  82.  *
  83.  *    Individual component halftones of a gs_ht structure must always be
  84.  *    provided with transfer functions.
  85.  *
  86.  *    Releasing the gs_ht structure will NOT release the client data 
  87.  *    (the client must do that directly).
  88.  */
  89.  
  90. extern int gs_ht_build(P3(gs_ht ** ppht, uint num_comps, gs_memory_t * pmem));
  91.  
  92. extern int gs_ht_set_spot_comp(P9(
  93.                      gs_ht * pht,
  94.                      int component_index,
  95.                      gs_ht_separation_name sepr_name,
  96.                      floatp freq,
  97.                      floatp angle,
  98.                      float (*spot_func) (P2(floatp, floatp)),
  99.                      bool accurate,
  100.                      gs_ht_transfer_proc transfer,
  101.                      const void *client_data
  102.                    ));
  103.  
  104. extern int gs_ht_set_threshold_comp(P8(
  105.                       gs_ht * pht,
  106.                       int component_index,
  107.                       gs_ht_separation_name sepr_name,
  108.                       int width,
  109.                       int height,
  110.                       const gs_const_string * thresholds,
  111.                       gs_ht_transfer_proc transfer,
  112.                       const void *client_data
  113.                     ));
  114.  
  115. /*
  116.  * This procedure specifies a (possibly non-monotonic) halftone of size
  117.  * width x height with num_levels different levels (including white, always
  118.  * all 0s, but excluding black, always all 1s).  Each mask is in the form of
  119.  * a gs_bitmap, except that there is no row padding -- the 'raster' is
  120.  * ceil(width / 8).
  121.  *
  122.  * Note that the client is responsible for releasing the mask data.
  123.  */
  124. extern int gs_ht_set_mask_comp(P9(
  125.                      gs_ht * pht,
  126.                      int component_index,
  127.                      gs_ht_separation_name sepr_name,
  128.                      int width,
  129.                      int height,
  130.                      int num_levels,
  131.                      const byte * masks,    /* width x height x num_levels */
  132.                      gs_ht_transfer_proc transfer,
  133.                      const void *client_data
  134.                    ));
  135.  
  136. extern void gs_ht_reference(P1(gs_ht * pht));
  137. extern void gs_ht_release(P1(gs_ht * pht));
  138.  
  139. #define gs_ht_assign(pto, pfrom)    \
  140.     BEGIN                           \
  141.         gs_ht_reference(pfrom);     \
  142.         if (pto != 0)               \
  143.             gs_ht_release(pto);     \
  144.         pto = pfrom;                \
  145.     END
  146.  
  147. #define gs_ht_init_ptr(pto, pfrom)          \
  148.     BEGIN gs_ht_reference(pfrom); pto = pfrom; END
  149.  
  150. extern int gs_ht_install(P2(gs_state * pgs, gs_ht * pht));
  151.  
  152. #endif /* gshtx_INCLUDED */
  153.